import matplotlib.pyplot as plt
import numpy as np

x = np.array([1,2,3,4,5,6,7,8,9])
xticklabels = ["10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%"]
y = [10,20,34,46,60,92,154,260,366]


fig, ax = plt.subplots(figsize=(12, 8))
plt.tick_params(labelsize=40)
    
bar_width = 0.5
spacing = 0
plt.bar(x - bar_width / 2 - spacing / 2, y, bar_width,)
plt.xticks(x, xticklabels, fontsize=30)

plt.xlabel('Workload', fontsize=40)
plt.ylabel('Max Active Flows', fontsize=40)
# plt.legend(prop={'size': 28, 'weight': 'normal'},columnspacing=1)
plt.grid(axis='y', linestyle='--', linewidth=0.5)
# plt.grid(True, which="both", ls="--", linewidth=0.5)

plt.tight_layout()

png_save_name = f'img/active_flows.png'
plt.savefig(png_save_name, format='png', dpi=300, bbox_inches="tight")
pdf_save_name = f'img/active_flows.pdf'
plt.savefig(pdf_save_name, format='pdf', dpi=300, bbox_inches="tight")
print(f"图像已保存到{png_save_name}.png {pdf_save_name}.pdf")